﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QuanLyDiem.models;
using DevExpress.XtraEditors;
namespace QuanLyDiem.Controllers
{
    public class C_KhoaHoc
    {
        public static void LoadDataSource(LookUpEdit lookUpEdit, Context db = null)
        {
            if (db == null) db = new Context();
          //  lookUpEdit.Properties.Columns.Clear();
            lookUpEdit.Properties.DataSource = db.ChuongTrinhDaoTaos.Select(o => o.Khoa_hoc).Distinct().ToList();
      //      lookUpEdit.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Khoa_hoc", "Khóa học"));
            lookUpEdit.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFit;
         //   lookUpEdit.Properties.DisplayMember = "Khoa_hoc";
           lookUpEdit.Properties.NullValuePromptShowForEmptyValue = true;
            lookUpEdit.Properties.AllowDropDownWhenReadOnly = DevExpress.Utils.DefaultBoolean.True;
            lookUpEdit.ItemIndex = 0;
        }
    }
}
